package com.xk.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xk.entity.DictData;
import com.xk.mapper.DictDataMapper;
import com.xk.service.DictDataService;
import org.springframework.stereotype.Service;

/**
 * 字典数据表(DictData)表服务实现类
 *
 * @author YaWu
 * @since 2024-12-15 00:01:21
 */
@Service("dictDataService")
public class DictDataServiceImpl extends ServiceImpl<DictDataMapper, DictData> implements DictDataService {

    @Override
    public boolean checkDictData(Long dictValue, String dictType) {
        LambdaQueryWrapper<DictData> queryWrapper= new LambdaQueryWrapper<DictData>()
                .eq(DictData::getDictType,dictType)
                .eq(DictData::getDictValue,dictValue)
                .last("LIMIT 1");
        DictData dictData = this.getOne(queryWrapper);
        if(dictData == null){
            return false;
        }
        return true;
    }
}

